﻿@namespace AntDesign
@inherits AntDomComponentBase
@inject NavigationManager _navigationManager

<Tabs Class="@Class" Style="@Style" Id="@Id" HideAdd Type="@TabType.EditableCard" @bind-ActiveKey="@ReuseTabsService.CurrentUrl" OnClose="@(key=>ReuseTabsService.ClosePage(key))" Draggable="@Draggable" Size="@Size">
     @if (ReuseTabsService.Pages?.Any() == true)
     {
         @foreach (var item in ReuseTabsService.Pages)
         {
             <TabPane @key="@item.Url" Key="@item.Url" Class="@TabPaneClass" Closable="item.Closable" ForceRender>
                 <TabTemplate>
                    @item.Title
                </TabTemplate>
                 <TabContextMenu>
                     <Menu>
                         <MenuItem OnClick="@(()=>{ReuseTabsService.ReloadPage(item.Url);})">@Locale.Reload</MenuItem>
                         <MenuItem Disabled="!item.Closable" OnClick="@(()=>{ReuseTabsService.ClosePage(item.Url);})">@Locale.Close</MenuItem>
                         <MenuItem OnClick="@(()=>ReuseTabsService.CloseAll())">@Locale.CloseAllTabs</MenuItem>
                         <MenuItem OnClick="@(()=>{ ReuseTabsService.CloseOther(item.Url);})">@Locale.CloseAllButThis</MenuItem>
                         @* <MenuItem OnClick="@(()=>{ ReuseTabsService.Pin(item.Url);})">@Locale.PinTab</MenuItem> *@
                     </Menu>
                 </TabContextMenu>
                 <ChildContent>
                    @if (!HidePages)
                    {
                        @item.Body
                    }
                 </ChildContent>
             </TabPane>
         }
     }
</Tabs>

@* @if (!HidePages)
{
    <ReusePages />
}
 *@